#include "StaticJavaLib.h"
#include "gc.h"
struct ANode{
  struct BNode* bnode;
  int value;
};

struct BNode{
  struct CNode* cnode;
  int value;
};

struct CNode{
  struct DNode* dnode;
  int value;
};

struct DNode{
  struct BNode* bnode;
  int value;
};

struct SyntaxTest5{
};

void main(int argc,char** argv){
  struct ANode* A1;
  gc_add_root_node(&A1);
  struct BNode* B1;
  gc_add_root_node(&B1);
  struct CNode* C1;
  gc_add_root_node(&C1);
  struct DNode* D1;
  gc_add_root_node(&D1);
  A1 = (struct ANode*)gc_malloc(sizeof(struct ANode));
  A1->value = 1;
  A1->bnode = (struct BNode*)gc_malloc(sizeof(struct BNode));
  A1->bnode->cnode = (struct CNode*)gc_malloc(sizeof(struct CNode));
  A1->bnode->value = 2;
  A1->bnode->cnode->dnode = (struct DNode*)gc_malloc(sizeof(struct DNode));
  A1->bnode->cnode->value = 3;
  A1->bnode->cnode->dnode->bnode = A1->bnode;
  A1->bnode->cnode->dnode->value = 4;
  A1 = (struct ANode*)gc_malloc(sizeof(struct ANode));
  A1->value = 5;
  B1 = (struct BNode*)gc_malloc(sizeof(struct BNode));
  B1->value = 6;
  C1 = (struct CNode*)gc_malloc(sizeof(struct CNode));
  C1->value = 7;
  D1 = (struct DNode*)gc_malloc(sizeof(struct DNode));
  D1->value = 8;
  A1->bnode = B1;
  B1->cnode = C1;
  C1->dnode = D1;
  D1->bnode = B1;
  B1 = (struct BNode*)gc_malloc(sizeof(struct BNode));
  B1->value = 9;
  C1 = (struct CNode*)gc_malloc(sizeof(struct CNode));
  C1->value = 10;
  D1 = (struct DNode*)gc_malloc(sizeof(struct DNode));
  D1->value = 11;
  StaticJavaLib_printlni(A1->value);
  StaticJavaLib_printlni(B1->value);
  StaticJavaLib_printlni(C1->value);
  StaticJavaLib_printlni(D1->value);
  gc_free_root_node(&A1);
  gc_free_root_node(&B1);
  gc_free_root_node(&C1);
  gc_free_root_node(&D1);
  gc_recycle();
}
